<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@include file="/WEB-INF/jsp/include/tags.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>orders - list</title>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript">
	<!--
		function goPage(page) {
			var f = document.ordersCriteriaForm;
			f.action = '/orders.do';
			f.method = 'get';
			f.elements["mode"].value = "list";
			f.elements["paging.currentPage"].value = page;
			f.submit();
		}
		
		function search() {
			var f = document.ordersCriteriaForm;
			f.action = '/orders.do';
			f.method = 'get';
			f.elements["mode"].value = "list";
			f.elements["paging.currentPage"].value = 0;
			f.submit();
		}
		
		function goDetail(orderid) {
			var f = document.ordersCriteriaForm;
			f.action = '/orders.do';
			f.method = 'get';
			f.elements["mode"].value = "detail";
			f.elements["orderid"].value = orderid;
			f.submit();
		}
		
		function goWrite() {
			var f = document.ordersCriteriaForm;
			f.action = '/ordersWrite.do';
			f.method = 'get';
			f.elements["mode"].value = "write";
			f.submit();
		}
	//-->
	</script>
</head>
<body>

	<p>
		<a href="/">home</a>
	</p>

	<h1>Orders - list</h1>

	<form:form commandName="ordersCriteria" id="ordersCriteriaForm"
		name="ordersCriteriaForm" action="/orders.do" method="get">
		<input type="hidden" name="mode" />
		<form:hidden path="orderid" />
		<form:hidden path="paging.currentPage" />
	</form:form>

	<div>${ordersCriteria.paging.totalResults} results.</div>

	<table width="800">
		<colgroup width="800">
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
		</colgroup>
		<tr>
			<th>orderid</th>
			<th>userid</th>
			<th>orderdate</th>
			<th>shipaddr1</th>
			<th>shipaddr2</th>
			<th>shipcity</th>
			<th>shipstate</th>
			<th>shipzip</th>
			<th>shipcountry</th>
			<th>billaddr1</th>
			<th>billaddr2</th>
			<th>billcity</th>
			<th>billstate</th>
			<th>billzip</th>
			<th>billcountry</th>
			<th>courier</th>
			<th>totalprice</th>
			<th>billtofirstname</th>
			<th>billtolastname</th>
			<th>shiptofirstname</th>
			<th>shiptolastname</th>
			<th>creditcard</th>
			<th>exprdate</th>
			<th>cardtype</th>
			<th>locale</th>
		</tr>
		<c:forEach var="orders" items="${ordersList}">
			<tr>
				<td><a href="javascript:goDetail('${orders.orderid}');"> <c:out
							value="${orders.orderid}" />
				</a></td>
				<td><c:out value="${orders.userid}" /></td>
				<td><fmt:formatDate value="${orders.orderdate}"
						pattern="yyyy-MM-dd HH:mm:ss" /></td>
				<td><c:out value="${orders.shipaddr1}" /></td>
				<td><c:out value="${orders.shipaddr2}" /></td>
				<td><c:out value="${orders.shipcity}" /></td>
				<td><c:out value="${orders.shipstate}" /></td>
				<td><c:out value="${orders.shipzip}" /></td>
				<td><c:out value="${orders.shipcountry}" /></td>
				<td><c:out value="${orders.billaddr1}" /></td>
				<td><c:out value="${orders.billaddr2}" /></td>
				<td><c:out value="${orders.billcity}" /></td>
				<td><c:out value="${orders.billstate}" /></td>
				<td><c:out value="${orders.billzip}" /></td>
				<td><c:out value="${orders.billcountry}" /></td>
				<td><c:out value="${orders.courier}" /></td>
				<td><c:out value="${orders.totalprice}" /></td>
				<td><c:out value="${orders.billtofirstname}" /></td>
				<td><c:out value="${orders.billtolastname}" /></td>
				<td><c:out value="${orders.shiptofirstname}" /></td>
				<td><c:out value="${orders.shiptolastname}" /></td>
				<td><c:out value="${orders.creditcard}" /></td>
				<td><c:out value="${orders.exprdate}" /></td>
				<td><c:out value="${orders.cardtype}" /></td>
				<td><c:out value="${orders.locale}" /></td>
			</tr>
		</c:forEach>
	</table>

	<div>
		<c:set var="paging" value="${ordersCriteria.paging}" />
		<%@ include file="/WEB-INF/jsp/include/paging/default.jsp"%>
	</div>

	<p />

	<a href="<c:url value='javascript:goWrite();'/>">write</a>
	<a href="<c:url value='/orders.do'/>">list</a>

</body>
</html>
